#include "common.h"
#include <stdio.h>
#include <cmath>
#include <memory>
#include <string>
#include <vector>
#ifdef LYNXI_PLUGIN
#include "lyn_plugin_dev.h"
#endif

namespace COMMON {

void generateClassNameAndNum(LabelList labelList,
                             std::vector<std::string>& class_names,
                             int& class_num) {
  if (0 == labelList.labelNum) {
    return;
  }

  LabelInfo *labels = nullptr;
#ifdef LYNXI_PLUGIN
    labels = (LabelInfo *)lynPluginGetVirtAddr(labelList.labels);
    if (labels == nullptr) {
      LOG_PLUGIN_E("get labels addr error\n");
      return;
    }
#else
    labels = labelList.labels;
#endif

  class_names.clear();
  for (int loop = 0; loop < labelList.labelNum; loop++) {
    class_names.push_back(labels[loop].name);
  }
  class_num = class_names.size();

  return;
}

}  // namespace COMMON
